package com.faiz.example;

import java.util.Random;

public class Shuffle {
    private Random random = new Random(5);

    public void shuffle(int[] a, int n) {
        int i = 0;
        int tmp = a[0];
        if (1 >= n) {
            return;
        }
//        生成随机数种子
        i = random.nextInt(n);
        if (0 == i) {
            return;
        }
        a[0] = a[i];
        a[i] = tmp;
        shuffle(a, n - 1);
        return;
    }
}
